package cn.com.header.web.mapper.sys;

import cn.com.header.core.util.Page;
import cn.com.header.web.model.sys.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 用户dao
 */

public interface UserDAO  {

    User authentication(User record);

    User selectByUsername(@Param("userName") String username);

    List<Map<String, Object>> selectByExampleAndPage(Page page);

    User get(Long id);

    void insert(User user);

    void delete(Long id);

    void update(User user);

    User selectByUserNameAndPwd(@Param("userName") String userName, @Param("userPwd") String userPwd);

    /**
     * 根据map查询
     * @param map
     * @return
     * @throws Exception
     */
    public boolean findByUserNameAndSchoolId(Map<String, Object> map) throws Exception;

    /**
     * 多条件查询
     * @param map
     * @return
     * @throws Exception
     */
    public User findAllByParams(Map<String, Object> map) throws Exception;


    Boolean isNumberUnique(@Param("number") String number,@Param("id")Long id);

    List<User> findByRoleId(Page page);

    public int check(Map<String, Object> map) throws Exception;

    /**
     * 根据用户id和学校id查出用户的类型
     * @param id
     * @param schoolId
     * @return
     */
    User findBySchoolIdAndUserId(@Param("id") Long id,@Param("schoolId") Long schoolId);

    User findUser(Map<String,Object> map);
    String generateUserName(@Param("name") String name);

    User findByRelationUserId(@Param("relationUserId")String relationUserId);

}